// pages/cart/cart.js
//引入数据
import goods from '../../utils/products'
Page({
    data:{
      goods:goods
    },
    change(e){
      const {type,index} = e.currentTarget.dataset;
      const {goods} = this.data;
      if(type === '1'){
        if(goods[index].num === 1){
        }else{
          --goods[index].num;
        }
      }else{
        ++goods[index].num
      }
      // 更新视图
      this.setData({goods})
    },
  })